<?php

/**
 * TomatoCMS
 * 
 * LICENSE
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE Version 2 
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-2.0.txt
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@tomatocms.com so we can send you a copy immediately.
 * 
 * @copyright	Copyright (c) 2009-2010 TIG Corporation (http://www.tig.vn)
 * @license		http://www.gnu.org/licenses/gpl-2.0.txt GNU GENERAL PUBLIC LICENSE Version 2
 * @version 	$Id: Widget.php 5083 2010-08-29 13:30:30Z huuphuoc $
 * @since		2.0.0
 */
class News_Widgets_Featured_Widget extends Tomato_Widget {

    protected function _prepareShow() {
        $limit = $this->_request->getParam('limit', 15);
        $categoryId = $this->_request->getParam('category_id', null);
        $excludeCategoryIds = $this->_request->getParam('exclude_category_ids', null);
        $articleModel = Rabbit_Model_Factory::getInstance()->setModule('news')->getArticleModel();
        
        /**
         * @since 2.0.8
         */
        $articleModel->setLang($this->_request->getParam('lang'));

        $articles = $articleModel->getFeatured($limit, $categoryId, $excludeCategoryIds);

        $this->_view->assign('articles', $articles);

    }

}
